package com.akk.action;


import com.akk.business.AvsApplyCardBusiness;
import com.akk.module.avs.model.request.AvsIncreRecordRequest;
import com.akk.utils.RestResponse;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping(value = "/thmlfApi/card")
@Api(value = "信用卡增值API")
public class AvsIncreCardAction {

    @Autowired
    private AvsApplyCardBusiness cardBusiness;

    @ApiOperation(value = "获取信用卡列表",httpMethod = "GET",response = RestResponse.class)
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",dataType = "Int",name = "page",value = "当前页,默认为1",required = true),
            @ApiImplicitParam(paramType = "query",dataType = "Int",name = "limit",value = "返回条数,默认为6",required = true)
    })
    @RequestMapping(value = "/list")
    public RestResponse list(@RequestParam(required = false) Integer page, @RequestParam(required = false) Integer limit){
        return cardBusiness.list(page, limit);
    }

    @ApiOperation(value = "获取热门银行",httpMethod = "GET",response = RestResponse.class)
    @RequestMapping(value = "/hotBank")
    public RestResponse hotBank(){
        return cardBusiness.hotBank();
    }

    @ApiOperation(value = "提交信用卡申请记录",httpMethod = "POST",response = RestResponse.class)
    @RequestMapping(value = "/record",method = RequestMethod.POST)
    public RestResponse saveRecord(@Valid @ApiParam(name = "申请记录",value = "传入JSON对象",required = true) AvsIncreRecordRequest recordRequest, BindingResult bindingResult) {
        return cardBusiness.saveRecord(recordRequest, bindingResult);
    }

}
